home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-16 | 720 b | 25 lines | [TEXT/GEOL] |
- Item 5851103 13-Feb-90 10:24PST
-
- From: DAWSON.M Dawson, Mark
-
- To: CPLUS.DEV$ C++ Interest List--Developers
-
- Sub: Good KeyMap handling
-
- I'm trying to figure out a "good" way of determining if the option key has been
- pressed. In Pascal, you can "optionKeyPressed := theKeyMap[kOptionKey];"
- (where kOptionKey = 56 && theKeyMap is of type KeyMap).
-
- In C++/C (Events.h), KeyMap is defined as "typedef long KeyMap[4];".
-
- The only way I could figure to extract the right field is to:
- long *x = theKeyMap;
- optionKeyPressed = ((x[kOptionKey/sizeof(long)] >> (kOptionKey%sizeof(long))&1;
-
- Is there a cleaner way?
-
- Thanks,
-
- Mark
-
-